﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HIHS.BaseLib.Basics;
using HIHS.Logic.App;
namespace HIHS.Form.Main.FunctionControl
{
    public partial class FCMain : BaseShowControl
    {
        public FCMain()
        {
            InitializeComponent();
            this.button1.Tag = VersionType.Debug;
            this.button2.Tag = VersionType.Test;
            this.button3.Tag = VersionType.Pre;
            this.button4.Tag = VersionType.Release;
            AppResource ar = (AppResource)HIHSApplication.Resource;
            label2.Text = ar.AppConfig.VersionType.ToString();
            label2.Text += Application.ProductVersion;
            label5.Text = ar.LoginUserInfo.UserNameCn;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Button bt = (Button)sender;
            if (MessageBox.Show(this, "确定要切换到" + bt.Text + "版？", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                AppResource ar = (AppResource)HIHSApplication.Resource;
                ar.AppConfig.VersionType = (VersionType)bt.Tag;
                ar.AppConfig.ChangeVersionType();
                ar.AppConfig.Save();
                ClientApplicationUtility cy = (ClientApplicationUtility)HIHSApplication.Utility;
                cy.Restart(ApplicationRestartMode.Restart, null);
            }
        }
    }
}
